<%-- 
    Document   : order_step2
    Created on : Jan 19, 2013, 11:28:42 AM
    Author     : SONY
--%>

<%@page import="java.util.Iterator"%>
<%@page import="java.util.List"%>
<%@page import="model.MemberService"%>
<%@page import="model.User"%>
<%@page import="model.Member"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<% 
    String fullname = "";
    String address = "";
    String phone = "";
    if(request.getAttribute("Name") != null) {
        fullname = request.getAttribute("Name").toString();
    }
    if(request.getAttribute("Address") != null) {
        address = request.getAttribute("Address").toString();
    }
    if(request.getAttribute("Phone") != null) {
        phone = request.getAttribute("Phone").toString();
    }
    String title = "Bạn hãy nhập đầy đủ thông tin giao hàng bên dưới.";
    if(session.getAttribute("user_member") != null) { 
        title = "Bạn có thể thay đổi thông tin giao hàng bên dưới.";
        User user = (User) session.getAttribute("user_member");
        MemberService member_service = new MemberService();
        Member member = member_service.getMemberDetails_byMID(user.getMemberID());
        fullname = member.getLastName() + " " + member.getFirstName();
        address = member.getAddress();
        phone = member.getPhone();
   }
%>
<p style="font-weight:bold;"><%=title%></p>
<ul>
<% 
if(request.getAttribute("errorMsgs") != null) {
    List errorMsgs = (List) request.getAttribute("errorMsgs");
    Iterator errorMsg = errorMsgs.iterator();
    while(errorMsg.hasNext()) { 
        String error = errorMsg.next().toString(); %>
        <i style='color:red'><li><%=error%></li></i>
<% } } %>
</ul>
<form name="form1" method="post"  action="<c:url value="/nonmember/order_step2.do" />">
  <table width="600" border="0">
    <tr>
      <td colspan="2" style="font-weight: bold;">Thông Tin Giao Hàng</td>
    </tr>
    <tr>
	<td width=150><span class="required">*&nbsp;</span>Họ và Tên</td>
	<td width=450><input type="text" name="fullName" size="30" value="<%=fullname%>" /><br/>
    </tr>
    <tr>
	<td><span class="required">*&nbsp;</span>Địa Chỉ</td>
	<td><input type="text" name="address" size="60" value="<%=address%>" /><br/>
    </tr>
    <tr>
	<td><span class="required">*&nbsp;</span>Số Điện Thoại</td>
	<td><input type="text" name="phone" size="30" value="<%=phone%>" /><br/>
    </tr>

    <tr><td colspan="2">&nbsp;</td></tr>
    <tr><td colspan="2">&nbsp;</td></tr>
    <tr>
      <td colspan="2" style="font-weight: bold;">Chọn Hình Thức Thanh Toán</td>
    </tr>
    <tr>
      <td colspan="2" style="padding-left: 50px;">
          <select name="paymenttype" style="width: 400px;">
                <option value="Cash" >Thanh toán bằng tiền mặt trực tiếp tại địa chỉ giao hàng</option>
           </select>
      </td>
    </tr>
    <tr><td colspan="2">&nbsp;</td></tr>
    <tr>
      <td colspan="2" align=center><input type="submit" class="button" value='Xác Nhận Đặt Hàng'/></td>
    </tr>
  </table>
</form>